<%@ page language="java" pageEncoding="utf-8"
	contentType="text/html;charset=utf-8"%>
<%@ include file="/WEB-INF/views/common.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>注册申请</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<style type="text/css">
	body, div, ul, li, p {
		margin: 0;
		padding: 0;
		border: 0;
		list-style: none;
		text-decoration: none;
		outline: none;
		font-size:14px;
	}
	#header {
		height:70px;
		border-bottom:1px solid #cccccc;
	}
	#footer {
		padding:10 0 20px 0;
		border-top:1px solid #cccccc;
	}
	#content, #footer {
		padding:10px;
		margin:0 auto;
		width:970px;
	}
	.inputtext {
		height:25px;
		font-size:16px;
		padding:1px;
	}
	.validatorerror {
		padding:1px;
		color:#ff0000;
	}
	</style> 
	<script src="<c:url value="/resources/js/jquery.min.js"/>" type="text/javascript"></script>
	<script src="<c:url value="/resources/js/jquery.validate.min.js"/>" type="text/javascript"></script>
	<script type="text/javascript">
	$(document).ready(
		function(){
			/* 设置默认属性 */   
			$.validator.setDefaults({   
				submitHandler: function(form) { form.submit(); }   
			});

			var validator = $('#signupForm').validate({
				rules:{
					companyName: {
						required:	true,
						minlength:	5,
						remote:		"/signup/checkcompanyname"
					},
					companyId: {
						required:	true,
						minlength:	3,
						remote:		"/signup/checkcompanyid"
					},
					userId: {
						required:	true,
						email:		true,
						remote:		"/signup/checkuserid"
					},
					passwd: {
						required:	true,
						minlength:	6
					},
					passwdConfirm: {
						required: true,
						equalTo: "#passwd"
					},
					verifyCode:		"required",
					agreePolicy:	"required"
				}, 
				
				messages: {
					companyName: {
						required:	"企业名称必须输入",
						minlength:	"企业名称长度为 5-64 位",
						remote:		"企业名称已经存在"
					},
					companyId: {
						required:	"访问地址必须填写",
						minlength:	"访问地址长度为 3-32 位",
						remote:		"访问地址已经存在"
					},
					userId: {
						required:	"电子邮件必须输入",
						email:		"请输入有效的电子邮件地址",
						remote:		"电子邮件已经存在"
					},
					passwd: {
						required:	"密码必须输入",
						minlength:	"密码长度为 6-64 位"
					},
					passwdConfirm: {
						required: 	"密码确认必须输入",
						equalTo: 	"两次密码输入不一致"
					},
					verifyCode:		"验证码必须输入",
					agreePolicy:	"只有同意服务条款，才能进行注册"
				},
				errorElement: "span",
				errorPlacement: function(error, element) {
					error.appendTo(element.parent());
					error.addClass('validatorerror');
				},
				
				success: function(label) {   
					label.html("&nbsp;").addClass("checked");
				},
				
				onkeyup: false
			});
			validator.showErrors({
				<c:forEach items="${requestScope['org.springframework.validation.BindingResult.company'].fieldErrors}" var="fielderror">
				"${fielderror.field}":"<fmt:message key="${fielderror.defaultMessage}" />",
				</c:forEach>
				<c:forEach items="${requestScope['org.springframework.validation.BindingResult.employee'].fieldErrors}" var="fielderror">
				"${fielderror.field}":"<fmt:message key="${fielderror.defaultMessage}" />",
				</c:forEach>
				"":""
			});
		}
	);
	</script>
</head>
<body>
<div id="header">ss</div>
<div id="content">
<div style="float: right; width: 360px;"> 说明: </div>
<div style="margin-right: 370px;">
	<form action="/signup" name="signupForm" id="signupForm" method="post">
	
	<div style="padding:5px;">* <label for="companyName">企业名称</label> </div>
	<div><input type="text" name="companyName" id="companyName" value="<c:out value="${company.companyName}" />" class="inputtext" maxlength="64"/></div>
	
	<div style="padding:5px;">* 访问地址</div>
	<div><input type="text" name="companyId" id="companyId" value="<c:out value="${company.companyId}" />" class="inputtext" maxlength="32"/>.qianren.com</div>
	
	<div style="padding:5px;">联系电话</div>
	<div><input type="text" name="phone" id="phone" value="<c:out value="${company.phone}" />"  class="inputtext" maxlength="32"/></div>
	
	<div style="padding:5px;">* 电子邮件 （管理账号）</div>
	<div><input type="text" name="userId" id="userId" value="<c:out value="${employee.userId}" />"  class="inputtext" maxlength="128"/></div>
	
	<div style="padding:5px;">* 密码</div>
	<div><input type="password" name="passwd" id="passwd" value="<c:out value="${employee.passwd}" />" class="inputtext" maxlength="64"/></div>
	
	<div style="padding:5px;">* 密码确认</div>
	<div><input type="password" name="passwdConfirm" id="passwdConfirm" value="<c:out value="${employee.passwdConfirm}" />" class="inputtext"/></div>
	
	<div style="padding:5px;">* 验证码</div>
	<div><input type="text" name="verifyCode" id="verifyCode" value="" class="inputtext" maxlength="60"/> <img src="/verification" align="absmiddle"/></div>
	
	<div style="padding:5px;">
	<input type="checkbox" name="agreePolicy" value="true" <c:if test="${employee.agreePolicy}">checked</c:if>/>
	同意本站服务条款
	</div>
	
	<div>
	<input type="submit" name="" value=" 注册 "/>
	</div>
	</form>
</div>
</div>
<div id="footer">sss</div>
</body>
</html>